{extend name="base" /}
{block name="css"}
<style>
#preview img{
  max-width: 600px;
  max-height:150px;
}
#adsForm .ipt{float:left;}
</style>
<link rel="stylesheet" type="text/css" href="__STATIC__/plugins/webuploader/webuploader.css?v={$v}" />
{/block}
{block name="js"}
<script type='text/javascript' src='__STATIC__/plugins/webuploader/webuploader.js?v={$v}'></script>
<script src="__INDEX__/ads/ads.js?v={$v}" type="text/javascript"></script>
{/block}
{block name="main"}
<div class="l-loading" style="display: block" id="htr-loading"></div>
<form id="adsForm">
<table class='htr-form htr-box-top'>
       <tr>
          <th width='150'>广告位置<font color='red'>*</font>：</th>
          <td>
            <select id="ad_position" name="ad_position" class='ipt' maxLength='20'>
              <option value="0"{if $data['ad_position']==0} selected="selected"{/if}>头部轮播</option>
              <option value="1"{if $data['ad_position']==1} selected="selected"{/if}>底部推荐</option>
            </select>
          </td>
       </tr>
       <tr>
          <th>广告标题<font color='red'>*</font>：</th>
          <td><input type='text' id='ad_name' name="ad_name" value='{$data['ad_name']}' class='ipt' maxLength='20'/></td>
       </tr>
       <tr>
          <th>广告图片<font color='red'>*</font>：</th>
          <td><div id='adFilePicker'>上传广告图</div><span id='uploadMsg'></span>
              <div>
                图片大小:<span id="img_size">720x360</span>(px)，格式为 gif, jpg, jpeg, png
              </div>
          </td>

       </tr>
       <tr>
          <th>预览图<font color='red'>  </font>：</th>
          <td>
            <div id="preview" style="min-height:30px;">
              {if ($data['ad_pic']!='')}
              <img src="__ROOT__/{$data['ad_pic']}">
              {/if}
            </div>
            <input type="hidden" name="ad_pic" id="ad_pic" class="ipt" value="{$data['ad_pic']}" />
          </td>
       </tr>
       <tr>
          <th>广告网址<font color='red'>  </font>：</th>
          <td>
            <input type="text" id="ad_url" class="ipt" value='{$data['ad_url']}' />
          </td>
       </tr>
       <tr>
          <th >广告开始时间<font color='red'>*</font>：</th>
          <td>
            <input type="text" style="margin:0px;vertical-align:baseline;" id="start_date" name="start_date" class="ipt" maxLength="20" value='{$data['start_date']|date="Y-m-d",###}' />
          </td>
       </tr>
       <tr>
          <th>广告结束时间<font color='red'>*</font>：</th>
          <td>
            <input type="text" style="margin:0px;vertical-align:baseline;" id="end_date" name="end_date" class="ipt" maxLength="20" value='{$data['end_date']|date="Y-m-d",###}' />
          </td>
       </tr>
       <tr>
          <th>广告排序号：</th>
          <td>
            <input type="text" id="ad_sort" class="ipt" maxLength="20"  value='{$data['ad_sort']}' />
          </td>
       </tr>
  
  <tr>
     <td colspan='2' align='center'>
       <input type="hidden" name="id" id="ad_id" class="ipt" value="{$data['ad_id']+0}" />
       <input type="submit" value="提交" class='btn btn-blue' />
       <input type="button" onclick="javascript:history.go(-1)" class='btn' value="返回" />
     </td>
  </tr>
</table>
</form>
<script>
$(function(){
editInit();
//时间插件
$("#start_date").ligerDateEditor().setValue('{$data['start_date']|date="Y-m-d",###}');
$("#end_date").ligerDateEditor().setValue('{$data['end_date']|date="Y-m-d",###}');
});
</script>
{/block}

